# -*- coding: utf-8 -*-
import sys, json,requests




class HanderTianXingApi(object):
    def __init__(self,date):

        self.date = date
        self.run()
    def run(self):
        """
        节假日接口
        """
        API_KEY='022f1b767b27e579577a63ad625a10ed'
        url = 'http://api.tianapi.com/txapi/jiejiari/index?key={0}&date={1}'.format(API_KEY,self.date)
        headers = {'Content-Type':'application/x-www-form-urlencoded'}
        req = requests.get(url, headers=headers)
        json_data=req.json()
        if  json_data['code'] == 200 :
            code=json_data['newslist'][0]['daycode']
            if code == 1 or code ==2 or code==3 :
                return False
            else:
                return True
        else:
            return True
           